<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../../common/tagInclude.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${basePath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK href="styleAdmin/css/portalinabox.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="styleAdmin/js/prototype-1.6.0.3.js"></script>
<script type="text/javascript" src="styleAdmin/js/common.js"></script>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>个人信息修改</title>
<script type="text/javascript">
	function checkForm(){
		var errors = "" ;
		if($F('roleId') == "" ){
			errors += "角色不能为空<br/>" ;
		}
		if(stringTrim($F('username')) == "" ){
			errors += "用户名不能为空<br/>" ;
		}
		var cate = $F("cate");
		if(cate != 'update'){
			if(stringTrim($F('password')) == "" ){
				errors += "密码不能为空<br/>" ;
			}
			if(stringTrim($F('passwordConfirm')) == "" ){
				errors += "确认密码不能为空<br/>" ;
			}
			if(stringTrim($F('password')) != ""  && stringTrim($F('passwordConfirm')) != "" && stringTrim($F('password')) != stringTrim($F('passwordConfirm'))){
				errors += "两次输入密码不一致<br/>" ;
			}
		}
		if(stringTrim($F('realName')) == "" ){
			errors += "姓名不能为空<br/>" ;
		}
		if(stringTrim($F('deptName')) == "" ){
			errors += "部门不能为空<br/>" ;
		}
		if(errors.length > 0){
			$('errors').innerHTML = "<font color='red' size='12'>" + errors  + "</font>" ;
			return ;
		} 
		document.myform.submit();
	}
</script>
</head>
<body bottomMargin="0" leftMargin="0" rightMargin="0" topmargin="0">
<form name="myform" method="post" action="${basePath}admin/user/personalUpdate">
<%@include file="../common/navigate.jsp" %>
<input type="hidden" id="cate" name="cate" value="${cate}"/>
<input type="hidden" id="userId" name="userId" value="${userInfo.id}"/>
<table width="90%" border="0" align="center" cellPadding="0" cellSpacing="0" style="margin-top:5px;">
 <tr><td align="center" colspan="2"><div id="errors"></div></td></tr>
 <tr>
	<td vAlign="top" align="center" height="157">
		<table width="10" border="1" class="mainFunctionTable"  cellpadding="0" cellspacing="1">
        	<tr height="25" class="pLabel">
            	<td colspan="2" class="td_nwarpstyle" align="left">&nbsp;&nbsp;个人信息修改</td>
            </tr>
			<tr>
         		<td align="center" width="10%">角色类型</td>
         		<td align="left">
         			<select name="roleId"  id="roleId" disabled="disabled">
         				<option value="">请选择</option>
         				<c:forEach items="${roleList}" var="role">
         					<option value="${role.roleId}" <c:if test="${role.roleId == userInfo.roleId}">selected</c:if>>${role.roleName}</option>
         				</c:forEach>
         			</select>
         			&nbsp;&nbsp;<font color='red'>*</font>
         		</td>
    		 </tr>
			<tr>
         		<td align="center" width="10%">用户名</td>
         		<td align="left"><input type="text" name="username" id="username" value="${userInfo.username}" readonly="readonly" size="80"/>&nbsp;&nbsp;<font color='red'>*</font></td>
    		 </tr>
			<tr>
         		<td align="center" width="10%">密码</td>
         		<td align="left"><input type="password" name="password" id="password" value="" size="80"/>&nbsp;&nbsp;
					<font color='red'>&nbsp;默认密码是admin&nbsp;&nbsp;留空不进行密码更改</font>
				</td>
    		 </tr>
			<tr>
         		<td align="center" width="10%">密码</td>
         		<td align="left"><input type="password" name="passwordConfirm" id="passwordConfirm" value="" size="80"/>&nbsp;&nbsp;<font color='red'>*</font></td>
    		 </tr>
			<tr>
         		<td align="center" width="10%">姓名</td>
         		<td align="left"><input type="text" name="realName" id="realName" value="${userInfo.realName}" size="80"/>&nbsp;&nbsp;<font color='red'>*</font></td>
    		 </tr>
    		 <tr>
         		<td align="center" width="10%">部门</td>
         		<td align="left"><input type="text" name="deptName" id="deptName" value="${userInfo.deptName}" size="80"/>&nbsp;&nbsp;<font color='red'>*</font></td>
    		 </tr>
			<tr>
         		<td align="center" width="10%">固定电话</td>
         		<td align="left"><input type="text" name="telphone" id="telphone" value="${userInfo.telphone}" size="80"/>&nbsp;&nbsp;<font color='red'>*</font></td>
    		 </tr>
			<tr>
         		<td align="center" width="10%">移动电话</td>
         		<td align="left"><input type="text" name="mobilephone" id="mobilephone" value="${userInfo.mobilephone}" size="80"/>&nbsp;&nbsp;<font color='red'>*</font></td>
    		 </tr>
			<tr>
         		<td align="center" width="10%">电子邮箱</td>
         		<td align="left"><input type="text" name="email" id="email" value="${userInfo.email}" size="80"/>&nbsp;&nbsp;<font color='red'>*</font></td>
    		 </tr>
            <tr align="left">
              <td align="center" colspan="2">
	              <a href="javascript:checkForm();"><img src="styleAdmin/images/button/save.gif" border=0></a>
              </td>
            </tr>
          </table>
      </td>
  </tr>
</table>
</form>
</body>
</html>